package com.beauxi.activities;

import com.beauxi.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

public class CromoDetalleActivity extends Activity {
    Integer id;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.cromo_detalle);
        
        ImageView iv = (ImageView) findViewById(R.id.imageView1);
        id = savedInstanceState != null ? savedInstanceState.getInt("_id"): null;
        
        if (id == null || id==0) {
			Bundle extras = getIntent().getExtras();
			id = extras != null
				? extras.getInt("_id")
				: null;
		}
        
        iv.setImageResource(id.intValue());
        iv.setClickable(true);
        
        iv.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent i = new Intent(CromoDetalleActivity.this,CromoReversoActivity.class);
                ImageView iv = (ImageView) v;
                String name = iv.getResources().getResourceEntryName(id.intValue());
            	i.putExtra("id_rev", id);
            	startActivity(i);
			}
		});
    }
}